<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>Getting Started</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta name="generator" content="Doc-O-Matic" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link rel="STYLESHEET" href="default.css" type="text/css" />

<script type="text/javascript" src="scripts.js"></script>
</head>
<body class="Element700" onload="onBodyLoadEx('frames.html', 'topic', 'Getting_Started.html');" onmousedown="onBodyMouseDown();">

<!-- Begin Popups -->

<!-- End Popups -->

<!-- Begin Page Header -->
<div class="Element710" id="areafixed">
<div class="Element94">
<em>You are here:</em> Using General SQL Parser &gt; <a href="Getting_Started.html" target="topic">Getting Started</a></div>
<div class="Element92">
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="50%">
<div class="Element2">
<a href="contents.html" target="tocidx"><img src="btn_globals_contents_midblue.gif" border="0" alt="Contents" title="Contents" onmouseover="switchImage(this, 'btn_globals_contents_midblue_hover.gif');" onmouseout="switchImage(this, 'btn_globals_contents_midblue.gif');"></a><a href="idx.html" target="tocidx"><img src="btn_globals_index_midblue.gif" border="0" alt="Index" title="Index" onmouseover="switchImage(this, 'btn_globals_index_midblue_hover.gif');" onmouseout="switchImage(this, 'btn_globals_index_midblue.gif');"></a><a href="index.html" target="topic"><img src="btn_globals_home_midblue.gif" border="0" alt="Home" title="Home" onmouseover="switchImage(this, 'btn_globals_home_midblue_hover.gif');" onmouseout="switchImage(this, 'btn_globals_home_midblue.gif');"></a></div>
</td><td width="50%">
<div class="Element90">
<a href="Registration.html" target="topic"><img src="btn_prev_midblue.gif" border="0" alt="Previous" title="Previous" onmouseover="switchImage(this, 'btn_prev_midblue_hover.gif');" onmouseout="switchImage(this, 'btn_prev_midblue.gif');"></a><img src="btn_up_d.gif" border="0" alt="Up" title="Up"><a href="How_to_use_join_table.html" target="topic"><img src="btn_next_midblue.gif" border="0" alt="Next" title="Next" onmouseover="switchImage(this, 'btn_next_midblue_hover.gif');" onmouseout="switchImage(this, 'btn_next_midblue.gif');"></a></div>
</td></tr></table><div class="Element5">
Getting Started</div>
</div>
</div>

<!-- End Page Header -->

<!-- Begin Client Area -->
<div class="Element720" id="areascroll">
<div class="Element721">

<!-- Begin Page Content -->
<div class="Element58">
<a name="Description"></a><div class="Element11">
<div class="Element10">
<p class="Element10">
General SQL Parser is a powerful component with rich set of features, Usually, you begin to code use one of the following code snippets:&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
1. </p><div class="Element13"><div class="Element12"><pre class="Element12"><a href="TGSqlParser.html" target="topic">TGSqlParser</a> sqlparser = new <a href="TGSqlParser.html" target="topic">TGSqlParser</a>(TDbVendor.DbVMssql); // replace TDbVendor.DbVMssql with other vendors when necessary
sqlparser.SqlText.Text = &quot;sql text here ...&quot;;
int iRet = sqlparser.Parse();

You code goes to here....
...
</pre></div></div>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
2. </p><div class="Element13"><div class="Element12"><pre class="Element12"><a href="TGSqlParser.html" target="topic">TGSqlParser</a> sqlparser = new <a href="TGSqlParser.html" target="topic">TGSqlParser</a>(TDbVendor.DbVMssql); // replace TDbVendor.DbVMssql with other vendors when necessary
sqlparser.SqlText.Text = &quot;sql text here ...&quot;;
int iRet = PrettyPrint();

You code goes to here....
...</pre></div></div>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
3. </p><div class="Element13"><div class="Element12"><pre class="Element12"><a href="TGSqlParser.html" target="topic">TGSqlParser</a> sqlparser = new <a href="TGSqlParser.html" target="topic">TGSqlParser</a>(TDbVendor.DbVMssql); // replace TDbVendor.DbVMssql with other vendors when necessary
sqlparser.SqlText.Text = &quot;sql text here ...&quot;;
int iRet = GetRawSqlStatements();

You code goes to here....
...</pre></div></div>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
int iRet = GetRawSqlStatements();&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
This function will analyze input sql script, and put each sql statement into SqlStatements&nbsp;</p>
<p class="Element10">
with corresponding SqlStatementType, besides SqlStatementType, the only available property&nbsp;</p>
<p class="Element10">
is SourceTokenList which includes all source tokens in this sql statement.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<strong><span style="color: #0000FF">If sql statement can be handled by GetRawSqlStatements, then we call this sql was supported in level 1, almost all sqls in oracle, sql server, db2, mysql was supported in this level.</span></strong>&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
Now, Let's move one step forward,&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
int iRet = sqlparser.Parse();&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<strong><span style="color: #0000FF">If sql statement can be handled by Parse function, then we call this sql was supported in level 2, after successfully parsed, there will be a parse tree that represent this sql sqlstatement, all detailed information such as clauses, expressions, predicates, queries will be available.</span></strong>&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
Parse function should be called first before any further processing of sql scripts.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
For detailed information about what's sql supported in level 1 or level 2 , check this table.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
There is another function people may use widely, PrettyPrint, this can beautify sql with lots of&nbsp;</p>
<p class="Element10">
format options.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
int iRet = PrettyPrint();&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
all sqls supported in level 2 will be handled correctly by PrettyPrint.&nbsp;</p>
<p class="Element10">
&nbsp;</p><div class="Element15">
More examples:</div>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The best way to getting started with this component is to check demos that meet your requirements, here is the list, and you can find more samples in demo directory shipped together with this component:&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<strong>1. XML output of sql query structure.</strong>&nbsp;</p>
<p class="Element10">
Try any sqls you have with this demo, check out how it was processed by sql parser, and what output you can get. By checking source code of this demo, you will familiar with most important properties and methods of this component.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<a href="http://www.sqlparser.com/dl/samples/xmloutput.zip">http://www.sqlparser.com/dl/samples/xmloutput.zip</a>&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<strong>2. Beautify SQL.</strong>&nbsp;</p>
<p class="Element10">
You can tidy sql within your program just with several lines of code.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<a href="http://www.sqlparser.com/dl/samples/prettyprint.zip">http://www.sqlparser.com/dl/samples/prettyprint.zip</a>&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<strong>3. Get database objects in sql.</strong>&nbsp;</p>
<p class="Element10">
There are several ways you can use to fetch database objects in sql statement, please check more detail information here:&nbsp;</p>
<p class="Element10">
<a href="http://www.sqlparser.com/docs/How_to_identify_DB_objects_in_your_sql.html">http://www.sqlparser.com/docs/How_to_identify_DB_objects_in_your_sql.html</a>&nbsp;</p>
<p class="Element10">
<a href="http://www.sqlparser.com/dl/samples/getdbobject.zip">http://www.sqlparser.com/dl/samples/getdbobject.zip</a>&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
<strong>4. Handle expression or predicates accurately.</strong>&nbsp;</p>
<p class="Element10">
Where clause or other clauses that include expression/predicates can be visited in different ways to accomplish your task.&nbsp;</p>
<p class="Element10">
<a href="http://www.sqlparser.com/docs/How_to_use_expression.html">http://www.sqlparser.com/docs/How_to_use_expression.html</a>&nbsp;</p>
<p class="Element10">
<a href="http://www.sqlparser.com/dl/samples/visitexpression.zip">http://www.sqlparser.com/dl/samples/visitexpression.zip</a>&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
Still doesn't find demos you need? Feel free to <a href="mailto: info@sqlparser.com">contact us</a> to request demo.</p></div>
</div>
</div>
<!-- End Page Content -->

<!-- Begin Page Footer -->
<div class="Element93">
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="100%">
<div class="Element3">
Gudu software http://www.sqlparser.com</div>
</td></tr><tr><td width="100%">
<div class="Element97">
Send <a href="#" onclick="sendFeedback('info@sqlparser.com', 'Documentation Feedback', 'Project: General SQL Parser Help file%0ATopic ID: Getting Started%0ATitle: Getting Started');">comments</a> about this topic.</div>
</td></tr></table></div>

<!-- End Page Footer -->
</div>
</div>

<!-- End Client Area -->
</body></html>